package net.qhzw.vip.qiyu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.qhzw.vip.qiyu.entity.MallSite;
import net.qhzw.vip.qiyu.mapper.MallSiteMapper;
import net.qhzw.vip.qiyu.service.MallSiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MallSiteServiceImpl extends ServiceImpl<MallSiteMapper, MallSite>
        implements MallSiteService {

    @Autowired
    private MallSiteMapper mallSiteMapper;

    @Override
    public Double getByShopId(Long shopId) {
        Double price = 0.0;
        MallSite mallSite = getOne(new LambdaQueryWrapper<MallSite>()
                .eq(MallSite::getShopId, shopId).last("LIMIT 1"));
        if (mallSite != null) {
            price = mallSite.getPrice();
        }
        return price;
    }


}
